Skip to content

Conversation

@kernel-patches-daemon-bpf-rc
Copy link

Pull request for series with
subject: bpf: Support fentry/fexit for functions with union args
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=999345

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 9621eb6
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=999345
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: e12873e
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=999345
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 93a83d0
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=999345
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: 60ef541
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=999345
version: 1

@kernel-patches-daemon-bpf-rc
Copy link
Author

Upstream branch: f859813
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=999345
version: 1

Currently, functions with 'union' arguments cannot be traced with
fentry/fexit:

bpftrace -e 'fentry:release_pages { exit(); }' -v
AST node count: 6
Attaching 1 probe...
ERROR: Error loading BPF program for fentry_vmlinux_release_pages_1.
Kernel error log:
The function release_pages arg0 type UNION is unsupported.
processed 0 insns (limit 1000000) max_states_per_insn 0 total_states 0 peak_states 0 mark_read 0

ERROR: Loading BPF object(s) failed.

The type of the 'release_pages' argument is defined as:

typedef union {
	struct page **pages;
	struct folio **folios;
	struct encoded_page **encoded_pages;
} release_pages_arg __attribute__ ((__transparent_union__));

This patch relaxes the restriction by allowing function arguments of type
'union' to be traced.

Signed-off-by: Leon Hwang <[email protected]>
Adding verifier test for accessing union argument in tracing programs.

The test program loads 1st argument of bpf_fentry_test11 function
which is union and checks that verifier allows that.

cd tools/testing/selftests/bpf
./test_progs -t verifier_btf_ctx
501/7   verifier_btf_ctx_access/btf_ctx_access union arg accept:OK
501     verifier_btf_ctx_access:OK
Summary: 1/7 PASSED, 0 SKIPPED, 0 FAILED

Signed-off-by: Leon Hwang <[email protected]>
@kernel-patches-daemon-bpf-rc
Copy link
Author

At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=999345 expired. Closing PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants